package com.nbsaas.boot.product.rest.resource;

import com.nbsaas.boot.product.api.apis.ProductFavoritesApi;
import com.nbsaas.boot.product.data.entity.ProductFavorites;
import com.nbsaas.boot.product.api.domain.request.ProductFavoritesRequest;
import com.nbsaas.boot.product.api.domain.response.ProductFavoritesResponse;
import com.nbsaas.boot.product.api.domain.simple.ProductFavoritesSimple;
import com.nbsaas.boot.product.rest.convert.ProductFavoritesSimpleConvert;
import com.nbsaas.boot.product.rest.convert.ProductFavoritesEntityConvert;
import com.nbsaas.boot.product.rest.convert.ProductFavoritesResponseConvert;
import com.nbsaas.boot.product.data.repository.ProductFavoritesRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   产品收藏-业务接口实现
*/
@Transactional
@Service
public class ProductFavoritesResource extends BaseResource<ProductFavorites,ProductFavoritesResponse, ProductFavoritesSimple, ProductFavoritesRequest>  implements ProductFavoritesApi {

    @Resource
    private ProductFavoritesRepository productFavoritesRepository;

    @Override
    public JpaRepositoryImplementation<ProductFavorites, Serializable> getJpaRepository() {
        return productFavoritesRepository;
    }

    @Override
    public Function<ProductFavorites, ProductFavoritesSimple> getConvertSimple() {
        return new ProductFavoritesSimpleConvert();
    }

    @Override
    public Function<ProductFavoritesRequest, ProductFavorites> getConvertForm() {
        return new ProductFavoritesEntityConvert();
    }

    @Override
    public Function<ProductFavorites, ProductFavoritesResponse> getConvertResponse() {
        return new ProductFavoritesResponseConvert();
    }




}


